<template>
  <div style="text-align: center;">
    <CheckoutValuationOperate v-if="urlForm.typePage === '1'" :url-form="urlForm" />
    <CheckoutValuationOperateAdjust v-if="urlForm.typePage === '2'" :url-form="urlForm" />
    <CheckoutValuationInDetailsvue v-if="urlForm.typePage === '3'" :url-form="urlForm" />
  </div>
</template>
<script>
    import CheckoutValuationOperate from '@/views/checkoutValuation/CheckoutValuationOperate' // 工程建设发起验工计价
    import CheckoutValuationOperateAdjust from '@/views/checkoutValuation/CheckoutValuationOperateAdjust' // 工程建设调减页面
    import CheckoutValuationInDetailsvue from '@/views/checkoutValuation/softwarePackage/CheckoutValuationInDetailsvue' // 套装软件页面

    import { setToken10 } from '@/utils/auth'
    export default {
      name: 'CheckoutValuationDetail',
      components: {
      CheckoutValuationOperate,
      CheckoutValuationOperateAdjust,
      CheckoutValuationInDetailsvue
      },
      data() {
        return {
          urlList: {},
          urlForm: {
              prjId: '',
              typePage: '', // 1工程建设发起验工计价 2工程建设调减页面 3套装软件页面
              newOldProject: '', // 新老项目 0新 1老
              itAccId: '', // itAccId 编码
              nodeNameWord: '', // 项目节点
              editor: '', // 套装软件页面是否可以操作
              token: ''
              // newBtnShow: '' // 新增按钮是否展示
            }
        }
      },
      created() {
        var urlVal = window.location.href
        this.urlList = this.GetRequest(urlVal)

        // 1.0 token转换2.0token
        console.log(this.urlList, this.urlForm, 'this.urlForm.token')
        if (this.urlList.token) {
          setToken10(this.urlList.token)
          // window.sessionStorage.setItem('systoken', this.urlList.token)
        }

        var manageMode = ''
        if (this.urlList.manageMode === '31' || this.urlList.manageMode === '04') {
            manageMode = '2'
        } else if (this.urlList.manageMode === '9999') {
            manageMode = '3'
        } else {
          manageMode = '1'
        }
        this.urlForm = {
          prjId: this.urlList.prjId,
          typePage: manageMode, // 1工程建设发起验工计价 2工程建设调减页面
          newOldProject: this.urlList.newOldProject,
          itAccId: this.urlList.itAccId,
          nodeNameWord: this.urlList.nodeNameWord,
          empId: this.urlList.empId,
          editor: this.urlList.editor,
          token: this.urlList.token,
          manageMode: this.urlList.manageMode,
          secondarytype: this.urlList.secondarytype
        }
        // 1.manageMode 项目管理方式等于31或者04时
        // 参数:typePage 传：字符串'2' ,
        // 2.manageMode 项目管理方式等于其他时
        // 参数:typePage 传:字符串'1'
      },
      mounted() {
      // this.collapseList.map(item => {
      //   this.childData[item.components] = this.$refs[item.components][0].$data
      // })
      // this.activeNames = this.collapseList.map(item => item.components)
      },
      methods: {
        GetRequest(url) {
          var theRequest = {}
          if (url.indexOf('?') !== -1) {
              var str = url.substr(1)
              var strs = str.split('?')
              var strsList = strs[1].split('&')
              for (var i = 0; i < strsList.length; i++) {
                theRequest[strsList[i].split('=')[0]] = strsList[i].split('=')[1]
              }
          }
          return theRequest
        }
      }
    }
</script>

<style>
    .el-collapse {
    margin-bottom: 15px;
    }
    .el-collapse-item {
    box-shadow: 0px 0px 6px 0px rgba(191, 192, 192, 0.52);
    /* 调整各个item之间的距离为20px */
    /* border: 1px; */
    }

    .el-collapse-item__wrap {
    padding: 0 20px;
    /* 为el-collapse-item的内容添加20像素的padding */
    }

    .el-collapse-item__header {
    padding-left: 20px;
    font-size: 14px;
    color: #333333;
    letter-spacing: 0;
    font-weight: 600;
    }

    .item_icon {
    width: 6px;
    background: rgb(235, 75, 75);
    height: 15px;
    margin-right: 10px;
    border-radius: 10px;
    }

    .content-box {
    width: 100%;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 400;
    line-height: 25px;
    }
</style>

